<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('新增项目成员')" />
	<th:block th:insert="~{include :: select2-css}" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
	    <form class="form-horizontal m" id="form-member-add">
	        <div class="form-group">
	            <label class="col-sm-3 control-label">项目：</label>
	            <div class="col-sm-8">
					<input type="text" class="form-control" name="projectName" id="projectName" disabled="disabled" />
					<input type="hidden" name="projectId" id="projectId" th:value="${projectId}"/>
					<!--
						
	                <select name="projectId" class="form-control" required>
	                    <option value="">请选择项目</option>
	                    <option th:each="project : ${projectList}" th:value="${project.id}" th:text="${project.name}" th:selected="${project.id == projectId}"></option>
	                </select>
					-->
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 control-label">用户：</label>
	            <div class="col-sm-8">
	                <select name="userId" class="form-control" required>
	                    <option value="">请选择用户</option>
	                    <option th:each="user : ${userList}" th:value="${user.userId}" th:text="${user.userName}"></option>
	                </select>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 control-label">角色：</label>
	            <div class="col-sm-8">
	                <select name="roleId" class="form-control" required>
	                    <option value="">请选择角色</option>
	                    <option th:each="role : ${projectRoleList}" th:value="${role.id}" th:text="${role.name}"></option>
	                </select>
	            </div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 control-label">备注：</label>
	            <div class="col-sm-8">
	                <textarea name="remark" class="form-control" rows="3" placeholder="请输入备注信息"></textarea>
	            </div>
	        </div>
	    </form>
	</div>
    <th:block th:include="include :: footer" />
	<th:block th:insert="~{include :: select2-js}" />
	<script th:src="@{/js/pm/project.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "project/member";

        $(function() {
			var projectId = $('#projectId').val();
			// 根据项目ID加载项目名称
			loadProjectInfo(projectId);
        });
        // 表单提交
		function submitHandler() {
		    if ($.validate.form()) {
		    	$.operate.save(prefix + "/add", $('#form-member-add').serialize(), function(result) {
                });
		    }
		}
    </script>
</body>
</html>